<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file= "../header.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加数据库配置信息</title>
<link href="/css/becom.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
   function operateTypeChange(){
	  if($("#methodOperateType").find("option:selected").val() != 0){
		  $("#retConfigDiv").hide();
	  } else {
		  $("#retConfigDiv").show();
	  }
	  
	  if($("#methodOperateType").find("option:selected").val() != 2){
		  $("#updateConfigDiv").hide();
	  } else {
		  $("#updateConfigDiv").show();
	  }
   }
</script>
</head>
<body>
    <p align="center" class="title">method config</p>
    <form action="/method/add.do" method="post">
        <table width="100%">
            <tr>
              <td width="50%">methodName</td>
              <td><input id="methodName" name="methodName" type="text" size="80%" /></td>
            </tr>
            
            <tr>
              <td>methodOperateType</td>
              <td>
                 <select name="methodOperateType" id="methodOperateType" onchange="operateTypeChange()">
                     <option value="0">select</option>
                     <option value="1">insert</option>
                     <option value="2">update</option>
                     <option value="3">delete</option>
                 </select>
                 
              </td>
            </tr>
            
            <tr>
              <td>methodParameterType</td>
              <td>
                  <select name="methodParameterType" id="methodParameterType">
                     <option value="0">fixedParamter</option>
                     <option value="1">beanParameter</option>
                 </select>
              
              </td>
            </tr>
            </table>
            
            
            <p align="center" class="title">method Parameter field config</p>
            <table width="100%">
            <tr>
              <td colspan="2"> <table width="100%">
	               <tr>
		              <td>
		                 <table width="100%">
		                    <tr >
		                       <td>parameter</td>
		                       <td>parameterType</td>
		                       <td>beginParameterName</td>
		                       <td>endParameterName</td>
		                       <td>listFlag</td>
		                       <td>operate</td>
		                    </tr>
			                 <c:forEach items="${bean.columnList}" var="item">
			                 
			                    <tr>
			                      <td width="20%">
			                        ${item.propertyName} 
			                      </td>
			                      
			                      <td width="20%">
			                        ${item.valueType.name} 
			                      </td>
			                      
			                      <td width="20%">
			                        <c:choose>
			                          <c:when test="${item.between}">
			                             <input id="${item.id}_parameter_begin" name="${item.id}_parameter_begin" type="text" />
			                          </c:when>
			                          <c:otherwise>
			                           X
			                          </c:otherwise>
			                        </c:choose>
			                      </td>
			                      
			                      <td width="20%">
			                      <c:choose>
			                        <c:when test="${item.between}">
			                           <input id="${item.id}_parameter_end" name="${item.id}_parameter_end" type="text" />
			                        </c:when>
			                          <c:otherwise>
			                           X
			                          </c:otherwise>
			                        </c:choose>
			                      </td>
			                      
			                      <td>
			                      
			                      <c:choose>
			                        <c:when test="${item.list}">
			                           <select name="${item.id }_listFlag" id="${item.id }_listFlag">
				                        <option value="0">false</option>
				                        <option value="1">true</option>
				                      </select>
			                        </c:when>
			                          <c:otherwise>
			                           X
			                          </c:otherwise>
			                        </c:choose>
			                      
			                          
			                      </td>
			                      
			                      <td width="20%">
			                        <input id="${item.id}_parameter" name="${item.id}_parameter" type="checkbox"  />
			                      </td>
			                    </tr>
			                 </c:forEach>
		                 </table>
		              
		              </td>
	              </tr>
              </table> </td>
            </tr>
          </table>  
            
            <div id="retConfigDiv">
	            <p align="center" class="title">method return field config</p>
	            <table width="100%">
	            <tr>
	              <td colspan="2"> <table width="100%">
		               <tr>
			              <td>
			                 <table width="100%">
			                    <tr >
			                       <td>parameter</td>
			                       <td>operate</td>
			                    </tr>
				                 <c:forEach items="${bean.columnList}" var="item">
				                    <tr>
				                      <td width="20%">
				                        ${item.propertyName} 
				                      </td>
				                      
				                      <td width="20%">
				                        <input id="${item.id}_result" name="${item.id}_result" type="checkbox"  />
				                      </td>
				                    </tr>
				                 </c:forEach>
				                 <tr>
				                 <td>methodResultType</td>
				                 <td>
				                   <select name="methodResultType" id="methodResultType">
					                     <option value="1">select_bean</option>
					                     <option value="2">select_bean_list</option>
					                     <option value="3">select_map</option>
					                 </select>
				                 </td>
				                 </tr>
			                 </table>
			              
			              </td>
		              </tr>
	              </table> </td>
	            </tr>
	          </table>  
           </div> 
           
           
           <div id="updateConfigDiv">
	            <p align="center" class="title">method update Field config</p>
	            <table width="100%">
	            <tr>
	              <td colspan="2"> <table width="100%">
		               <tr>
			              <td>
			                 <table width="100%">
			                    <tr >
			                       <td>parameter</td>
			                       <td>operate</td>
			                    </tr>
				                 <c:forEach items="${bean.columnList}" var="item">
				                    <tr>
				                      <td width="20%">
				                        ${item.propertyName} 
				                      </td>
				                      
				                      <td width="20%">
				                        <input id="${item.id}_update" name="${item.id}_update" type="checkbox"  />
				                      </td>
				                    </tr>
				                 </c:forEach>
			                 </table>
			              </td>
		              </tr>
	              </table> </td>
	            </tr>
	          </table>  
           </div> 
           
         <table width="100%">
            <tr>
              <td colspan="2" align="center">
                 <input type="hidden" id="tableId" name="tableId"  value="${bean.id }"/>
                 <input value="submit" type="submit" />
              </td>
            </tr>
        </table>
    </form>
</body>

<script type="text/javascript">
   $("#updateConfigDiv").hide();
</script>
</html>